/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */
import Layout from "@/framework/layout";

// 文档参照 https://panjiachen.github.io/vue-element-admin-site/zh/guide/essentials/router-and-nav.html

// 公开的路由
export const constantRoutes = [
  {
    path: "/redirect",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "/redirect/:path(.*)",
        component: () => import("@/app/views/redirect/index"),
      },
    ],
  },
];

// 需要权限验证的路由
export const asyncRoutes = [
  // {
  //   path: "/admin",
  //   component: Layout,
  //   name: "Admin",
  //   alwaysShow: true,
  //   redirect: "/admin/index",
  //   meta: { title: "账户管理", icon: "peoples" },
  //   children: [
  //     {
  //       path: "index",
  //       name: "AdminIndex",
  //       meta: { title: "后台账户管理" },
  //       component: () => import("@/app/views/admin/index"),
  //     },
  //   ],
  // },
  
  {
    path: "/shoppingcart",
    component: Layout,
    name: "ShoppingCart",
    redirect: "/shoppingcart/index",
    children: [
      {
        path: "index",
        name: "ShoppingCart",
        meta: { title: "购物车", icon: "el-icon-shopping-cart-2", affix: true },
        component: () => import("@/app/views/shoppingcart"),
      },
    ],
  },

  {
    path: "/user",
    component: Layout,
    name: "User",
    // alwaysShow: true,
    redirect: "/user/index",
    // meta: {title: '用户管理', icon: 'user'},
    children: [
      {
        path: "index",
        name: "User",
        meta: { title: "个人信息", icon: "el-icon-edit-outline", affix: true },
        component: () => import("@/app/views/user"),
      },
    ],
  },
  // {
  //   path: "/search",
  //   component: Layout,
  //   name: "Search",
  //   alwaysShow: true,
  //   redirect: "/search/search",
  //   meta: { title: "花型检索管理", icon: "el-icon-search" },
  //   children: [
  //     {
  //       path: "search",
  //       name: "Search",
  //       meta: { title: "花型检索" },
  //       component: () => import("@/app/views/search/search"),
  //     },
  //     {
  //       path: "flowerInfo/:pid/:isCart",
  //       name: "FlowerInfoo",
  //       meta: { title: "花型详情" },
  //       component: () => import("@/app/views/flower/info"),
  //       hidden: true,
  //     },
  //   ],
  // },
  {
    path: "/order",
    component: Layout,
    name: "Order",
    alwaysShow: true,
    redirect: "/order/persinal",
    meta: { title: "订单管理", icon: "el-icon-tickets" },
    children: [
      {
        path: "persinal",
        name: "persinal",
        meta: { title: "个人订单" },
        component: () => import("@/app/views/order/personal"),
      },
      {
        path: "review",
        name: "review",
        meta: { title: "审核订单" },
        component: () => import("@/app/views/order/review"),
      },
      {
        path: "pInfo/:oid",
        name: "Pinfo",
        meta: { title: "个人订单详情" },
        component: () => import("@/app/views/order/pinfo"),
        hidden: true,
      },
      {
        path: "rInfo/:oid",
        name: "Rinfo",
        meta: { title: "审核订单详情" },
        component: () => import("@/app/views/order/rinfo"),
        hidden: true,
      },
    ],
  },
  {
    path: "/flower",
    component: Layout,
    name: "Flower",
    alwaysShow: true,
    redirect: "/flower/flowerIndex",
    meta: { title: "花型管理", icon: "el-icon-goods" },
    children: [
      {
        path: "flowerIndex",
        name: "FlowerIndex",
        meta: { title: "花型库管理" },
        component: () => import("@/app/views/flower/index"),
      },
      {
        path: "flowerInfo/:pid/:isCart/:similarity_value",
        name: "FlowerInfo",
        meta: { title: "花型详情" },
        component: () => import("@/app/views/flower/info"),
        hidden: true,
      }
    ],
  },

  {
    path: "/system",
    component: Layout,
    name: "System",
    alwaysShow: true,
    redirect: "/system/organize",
    meta: { title: "系统管理", icon: "el-icon-setting" },
    children: [
      {
        path: "organize",
        name: "Organize",
        meta: { title: "组织管理" },
        component: () => import("@/app/views/system/organize"),
      },
      {
        path: "staff",
        name: "Staff",
        meta: { title: "员工管理" },
        component: () => import("@/app/views/system/staff"),
      },
      {
        path: "customer",
        name: "Customer",
        meta: { title: "往来单位管理" },
        component: () => import("@/app/views/system/customer"),
      },
      {
        path: "property",
        name: "property",
        meta: { title: "显示字段管理" },
        component: () => import("@/app/views/system/property"),
      },
      {
        path: "History",
        name: "History",
        meta: { title: "登录历史管理" },
        component: () => import("@/app/views/system/History"),
      },
      {
        path: "config",
        name: "config",
        meta: { title: "系统配置管理" },
        component: () => import("@/app/views/config/index"),
      },
      {
        path: "emailServer",
        name: "emailServer",
        meta: { title: "邮箱服务器配置" },
        component: () => import("@/app/views/system/emailServer"),
      },
    ],
  },
  {
    path: "/analysis",
    component: Layout,
    name: "Analysis",
    alwaysShow: true,
    redirect: "/analysis/behavior",
    meta: { title: "行为分析管理", icon: "el-icon-user" },
    children: [
      {
        path: "behavior",
        name: "Behavior",
        meta: { title: "搜花行为分析" },
        component: () => import("@/app/views/analysis/behavior"),
      },
      {
        path: "outcome/:pids",
        name: "Outcome",
        meta: { title: "搜索结果分析" },
        component: () => import("@/app/views/analysis/outcome"),
        hidden: true,
      },
    ],
  },
];
